package yt.demo.appcoresystem.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import yt.demo.appcommontools.utils.RequestUtils;
import yt.demo.appcommontools.utils.files.storage.AliyunStorageService;

@Service
public class UrlService {

    private final AliyunStorageService aliyunStorageService;

    @Autowired
    public UrlService(AliyunStorageService aliyunStorageService) {
        this.aliyunStorageService = aliyunStorageService;
    }

    public String getBucketName(Integer storageMode) {
        String bucketName = "";
        switch (storageMode) {
            case 1:
                bucketName = RequestUtils.getCurrentDomain();
                break;
            case 2:
                bucketName = aliyunStorageService.getBucketName();
                break;
        }
        return bucketName;
    }
}
